#include <iostream>
#include <list>

using namespace std;

int main()
{
  list<int> lt;
  lt.push_front(1);
  lt.push_front(2);
  lt.push_front(3);
  lt.push_front(4);
  
  //遍历可以用迭代器或者范围for，范围for底层也是迭代器
  list<int>::iterator it = lt.begin();
  while(it !=lt.end())
  {
    cout<<*it<<" ";
    it++;
  }
  //for(auto e : lt)
  //{
  //  cout<<e<<" ";
  //}
  cout<<endl;
  return 0;
}
